package com.guzhen.wallpager;

import android.content.Context;
import android.service.wallpaper.WallpaperService.Engine;
import android.service.wallpaper.WallpaperService;
import android.view.MotionEvent;
import android.view.SurfaceHolder;

public class ReviewLiveWallpaperService extends WallpaperService {
    public class ReviewEngine extends WallpaperService.Engine {
        private ReviewSurfaceView surfaceView;
        public  ReviewLiveWallpaperService service;
        private Context ctx;

        public ReviewEngine(Context context0, ReviewLiveWallpaperService s) {
            this.ctx = context0;
            service = s;
        }

        private void initView(SurfaceHolder surfaceHolder) {
            if(this.surfaceView == null) {
                this.surfaceView = new ReviewSurfaceView(this.ctx);
            }

            this.surfaceView.setHolder(surfaceHolder);
        }

        @Override  // android.service.wallpaper.WallpaperService$Engine
        public void onCreate(SurfaceHolder surfaceHolder0) {
            super.onCreate(surfaceHolder0);
            this.initView(surfaceHolder0);
        }

        @Override  // android.service.wallpaper.WallpaperService$Engine
        public void onSurfaceChanged(SurfaceHolder surfaceHolder0, int v, int v1, int v2) {
            super.onSurfaceChanged(surfaceHolder0, v, v1, v2);
        }

        @Override  // android.service.wallpaper.WallpaperService$Engine
        public void onSurfaceCreated(SurfaceHolder surfaceHolder0) {
            super.onSurfaceCreated(surfaceHolder0);
            this.surfaceView.surfaceCreated(surfaceHolder0);
        }

        @Override  // android.service.wallpaper.WallpaperService$Engine
        public void onSurfaceDestroyed(SurfaceHolder surfaceHolder0) {
            super.onSurfaceDestroyed(surfaceHolder0);
            this.surfaceView.surfaceDestroyed(surfaceHolder0);
        }

        @Override  // android.service.wallpaper.WallpaperService$Engine
        public void onTouchEvent(MotionEvent motionEvent0) {
            super.onTouchEvent(motionEvent0);
            this.surfaceView.onTouchEvent(motionEvent0);
        }

        @Override  // android.service.wallpaper.WallpaperService$Engine
        public void onVisibilityChanged(boolean z) {
            super.onVisibilityChanged(z);
            this.surfaceView.onVisChanged(z);
        }
    }

    @Override  // android.service.wallpaper.WallpaperService
    public WallpaperService.Engine onCreateEngine() {
        return new ReviewEngine(this, this);
    }
}

